<template>
  <div class="listen">
    <div class="top">
      <ul>
        <li><router-link to="/play/listen">听听</router-link></li>
        <li><router-link to="/play/recommend">推荐</router-link></li>
        <li><router-link to="/play/classify">分类</router-link></li>
      </ul>
    </div>
    <van-nav-bar>
      <template #left>
        <van-icon name="apps-o" size="18" @click="showpo" color="#333" />
      </template>
      <template #right>
        <van-icon name="ellipsis" size="18" color="#333" />
      </template>
    </van-nav-bar>

    <div class="content">
      <ul>
        <li
          v-for="item in list"
          :key="item._id"
          :style="{
            background: 'url(' + item.program.coverUrl + ')',
            'background-size': 'cover',
          }"
        >
          <span>播放量:{{ item.program.secondCategoryId }}</span>
          <p>{{ item.program.name }}</p>
        </li>
      </ul>
    </div>
    <!-- <van-tabs v-model="active" animated>
  <van-tab v-for="(item, index) in list" :key="index">
    内容 {{ item.a }}
  </van-tab>
</van-tabs> -->
    <!-- <div class="content"></div> -->
  </div>
</template>

<script>
import { reqListenApi } from "../../../api/radio";
export default {
  data() {
    return {
      list: [],
    };
  },
  computed: {},
  watch: {},

  methods: {
    //  全局事件总线
    showpo() {
      this.$bus.$emit("showPopup");
    },
    async listen() {
      const result = await reqListenApi({ limit: 30 });
      console.log(result);
      if (result.code === 200) {
        this.list = result.toplist;
        console.log(this.list);
      }
    },
  },
  created() {
    this.listen();
  },
  mounted() {},
  components: {},
};
</script>
<style scoped>
.play .content ul {
  width: 100%;
  flex-wrap: wrap;
  display: flex;
  justify-content: space-around;
  background-color: #fff;
  padding-bottom: 50px;
}
.play .content li {
  width: 47%;
  height: 193px;
  margin-top: 10px;
  position: relative;
}
.play .content li span {
  position: absolute;
  bottom: 25px;
  left: 5px;
  font-size: 12px;
  display: inline-block;
}
.play .content li p {
  position: absolute;
  width: 100%;
  bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: white;
}

.top {
  width: 80%;
  height: 50px;
  line-height: 50px;
  position: absolute;
  top: -4px;
  left: 47px;
  z-index: 999;
}

.top ul {
  width: 100%;
  height: 50px;
  line-height: 50px;
  text-align: center;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.top ul li {
  margin: 0 10px;
}
.top ul li:nth-of-type(1) a {
  color: black;
  font-size: 17px;
  font-weight: bold;
}
li:nth-of-type(1) a {
  position: relative;
}
li:nth-of-type(1) a:before {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 36px;
  height: 5px;
  border-radius: 5px;
  background: red;
}
</style>
